$(document).ready(function(){
	$(".btn_close").on("click", function(event) {
		window.close();
	});
	
	$(".btn_save").on("click", function(event) {
		
		url = "insertGroupAdd.jsp";
		serviceName = "GROUP_ADD";
		param = {
				system_name : $("#system_name").val(),
				group_name : $("#group_name").val(),
				group_auth : $("#group_auth option:selected").val(),
				group_ex : $("#group_ex").val()
		};
		
		callAjax(url,param, serviceName);
	});
	
	
	/* GROUP 중복체크 */
	$(".btn_overlapchk").on("click", function(event) {
		var url = "checkGroup.jsp";
		var serviceName = "GROUP_CHECKGROUP";
		var param = {
				group_name : $("#group_name").val()
		};
		callAjax(url,param, serviceName);
	});
	
});

/* callAjax successAjax */
function successAjax(data, serviceName){
	if(serviceName == "GROUP_ADD"){
		alert(data.result);
	}else if(serviceName == "GROUP_CHECKGROUP"){
		alert(data.result);
	}
}